<?php
/**
 * Copyright (c) 2019. Supefun<supefun@163.com> All rights reserved.
 */

namespace app\pdf\controller;



use think\App;
use think\Controller;

class Index extends Controller
{
    public function index()
    {
        //var_dump(App::getInstance()->env->get('VENDOR_PATH'));
        //$config = env('VENDOR_PATH').'tecnickcom/tcpdf/config/tcpdf_config.php';

// create new PDF document
        $pdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

        $fontFile=APP_ROOT_PATH . 'system/tcpdf/fonts/simfang.php';
        //$fontFile=APP_ROOT_PATH . 'system/tcpdf/fonts/stsongstdlight.php';如果用自带的stsongstdlight字体就不可以
        $pdf->AddFont('simfang', '', $fontFile,FALSE);

        $pdf->AddPage();
        $txt = "您好！";

        $pdf->Write(20, $txt);

        $pdf->Output('minimal.pdf', 'I');

        echo PDF_PAGE_FORMAT;
    }

    public function hello($name = 'ThinkPHP5')
    {
        return 'hello,' . $name;
    }
}
